<template>
<div id="wrapper">
  <main>
    <div class="left-side">
      <span class="title">
        Welcome to your new project! + {{main}}
      </span>
      <system-information></system-information>
    </div>

    <div class="right-side">
      <div class="doc">
        <div class="title">Getting Started</div>
        <p>
          <input type="text" name="" id="" v-model="countStateObj.val">
          electron-vue comes packed with detailed documentation that covers everything from
          internal configurations, using the project structure, building your application,
          and so much more.
        </p>
      </div>
      <div class="doc">
        <div class="title alt">Other Documentation</div>
      </div>
    </div>
  </main>
</div>
</template>

<script>
import SystemInformation from '../components/LandingPage/SystemInformation'
import {
  mapState,
  mapGetters,
  mapMutations,
  mapActions
} from 'vuex'

import {
  setTimeout
} from 'timers';

export default {
  name: 'landing-page',
  data() {
    return {
      main: 0,
    }
  },
  beforeCreate() {},
  created() {},
  beforeMount() {},
  mounted() {
    // this.main = this.aa;

    this.mainFun()
    console.log(this.main2, '-this.$store.state.Counter.main-------')
    console.log(this.state0, '-this.$store.state.Counter.main-------')
    setTimeout(() => {
      console.log(this.state0, '-this.$store.state.Counter.main-------')
      console.log(this.$store.state.Counter.state1, '+this.$store.state.Counter.main-------')
      console.log(this.countState1, '+countState1-------')
      console.log(this.state1, '测试state1-------')
      console.log(this.changeState, '测试changeState-------')
      console.log(this.countStateObj, '测试countStateObj-------')
    }, 1000)
  },
  watch: {

  },
  computed: {
    ...mapState({
      main2: (store) => {
        return store.Counter.main
      },
      state0: (store) => {
        return store.Counter.state0
      },
      state1: (store) => {
        return store.Counter.state1
      },
      changeState(store) {
        return store.Counter.changeState
      }
    }),

    // ...mapState(['state1']),
    // ...mapState(['changeState', 'state1']),

    ...mapGetters(['countState1', 'countStateObj']),
  },
  components: {
    SystemInformation
  },
  methods: {
    ...mapMutations(['state0Watch']),
    ...mapActions(['state0WatchAsyncTask']),

    mainFun() {
      this.$store.commit('state0Watch')
      this.$store.dispatch('state0WatchAsyncTask')
    }
  }
}
</script>

<style>
@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Source Sans Pro', sans-serif;
}

#wrapper {
  background:
    radial-gradient(ellipse at top left,
      rgba(255, 255, 255, 1) 40%,
      rgba(229, 229, 229, .9) 100%);
  height: 100vh;
  padding: 60px 80px;
  width: 100vw;
}

#logo {
  height: auto;
  margin-bottom: 20px;
  width: 420px;
}

main {
  display: flex;
  justify-content: space-between;
}

main>div {
  flex-basis: 50%;
}

.left-side {
  display: flex;
  flex-direction: column;
}

.welcome {
  color: #555;
  font-size: 23px;
  margin-bottom: 10px;
}

.title {
  color: #2c3e50;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 6px;
}

.title.alt {
  font-size: 18px;
  margin-bottom: 10px;
}

.doc p {
  color: black;
  margin-bottom: 10px;
}

.doc button {
  font-size: .8em;
  cursor: pointer;
  outline: none;
  padding: 0.75em 2em;
  border-radius: 2em;
  display: inline-block;
  color: #fff;
  background-color: #4fc08d;
  transition: all 0.15s ease;
  box-sizing: border-box;
  border: 1px solid #4fc08d;
}

.doc button.alt {
  color: #42b983;
  background-color: transparent;
}
</style>
